# See http://code.google.com/p/ath/source/browse/trunk/ath/LICENSE.TXT for license.
# Copyright 2008 by Mark Wolgemuth. All rights reserved.

import os
import sys
import string

def parse():
    fh_cconstants = open('../../c/include/ath_constants.h', 'r')
    fh_pgenconstants = open('CommonGenerated.py', 'w')
    for line in fh_cconstants:
        if line.find("#define") == -1:
            continue
        spline = line.split(None, 4)
        if len(spline) > 2:
            symbol = spline[1]
            value = spline[2]
            if ((len(symbol) > 0) & (len(value) > 0)):
                genline =  symbol + " = " + value + "\n"
                fh_pgenconstants.write(genline)
    fh_cconstants.close()
    fh_pgenconstants.close()


if __name__ == '__main__':
    parse()

    
